package com.jsoft.jsofted.framework.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.gitee.sunchenbin.mybatis.actable.annotation.Column;
import com.gitee.sunchenbin.mybatis.actable.annotation.IsNotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Id;
import java.sql.Timestamp;

/**
 * 有租户归属的实体类：即数据归属于某个特定的租户。
 */
@Data
@EqualsAndHashCode(callSuper = false)
public abstract class OfTenantEntity implements IdEntity, TimeEntity {

    @Id
    @Column
    @TableId(type = IdType.ASSIGN_ID)
    protected Long id;

    /**
     * 租户ID：自动获取登录用户 所属租户ID
     */
    @Column
//    @IsNotNull
    protected Long tenantId;

    @Column
    @IsNotNull
    protected Timestamp createTime;

    @Column
    @IsNotNull
    protected Timestamp updateTime = new Timestamp(System.currentTimeMillis());

}
